extension CURun<T> on T {
  R run<R>(R Function(T it) block) {
    return block(this);
  }
}

extension CULet<T> on T {
  R let<R>(R Function(T it) block) {
    return block(this);
  }
}

extension CUApply<T> on T {
  T apply(void Function(T it) block) {
    block(this);
    return this;
  }
}

extension CUAlso<T> on T {
  T also(void Function(T it) block) {
    block(this);
    return this;
  }
}

/// 测量时间
int measureTimeMillis(Function func) {
  final stopwatch = Stopwatch()..start();
  func();
  stopwatch.stop();
  return stopwatch.elapsedMilliseconds;
}
